
from core.base import *

from core.supplier import *

class ItemModel:
	def __init__(self):
		self.name = 'Nissan MR'
		self.code = 'M9R Turbo Diesel'
		self.supplier = SupplierModel()
		self.srp = 0.0
		self.num_stocks = 7

	def get_name(self):
		return self.name

	def set_name(self, name):
		self.name = name

	def get_code(self):
		return self.code

	def set_code(self, code):
		self.code = code

	def get_supplier(self):
		return self.supplier

	def set_supplier(self, supplier):
		self.supplier = supplier

	def get_srp(self):
		return self.srp

	def set_srp(self, srp):
		self.srp = srp

	def get_num_stocks(self):
		return self.num_stocks


class ItemController(BaseController):
	def get_all(self):
		items = []

		items.append(ItemModel())

		item2 = ItemModel()
		item2.set_code('MR20DD')
		items.append(item2)

		self.update_views(items)
		return items

	def get_all_from(self, supplier):
		return []

	def get_bestselling_product(self, month):
		"""
		Returns the bestselling product for the specified month.

		The 'month' parameter should be a QDateTime, with its month
		attribute set to the desired month. All other QDateTime
		attributes are ignored.
		"""
		return []

